package Controller;

import java.util.ArrayList;

import org.omg.CORBA.Request;

import EntityBean.GovOffice;

import com.opensymphony.xwork2.ActionSupport;

public class ViewDetailAction extends ActionSupport{
	
	private static final long serialVersionUID = 1L;
	private String govId;
	private String govName;
	
	private GovOffice gov;
	private ArrayList<GovOffice> govList;
	
	public String execute()
	{
		
		ControllerDB cont = new ControllerDB();
		govList = cont.getAll();
		
		int sizeList = govList.size();
		for(int i=0; i<sizeList; i++)
		{
		
			if(govList.get(i).getGovName().equals(govName))
			{
				    gov = new GovOffice(govList.get(i).getGovId(), govList.get(i).getGovName(), govList.get(i).getDescription(),
						govList.get(i).getCounty(), govList.get(i).getIsActive());
			} else {
					
				
			}
		}
		cont.updateDB(govName);
		return "success";
	}

	
	public ArrayList<GovOffice> getGovList() {
		return govList;
	}


	public void setGovList(ArrayList<GovOffice> govList) {
		this.govList = govList;
	}


	public GovOffice getGov() {
		return gov;
	}


	public void setGov(GovOffice gov) {
		this.gov = gov;
	}


	public String getGovId() {
		return govId;
	}


	public void setGovId(String govId) {
		this.govId = govId;
	}
	
	public String getGovName() {
		return govName;
	}


	public void setGovName(String govName) {
		this.govName = govName;
	}



}
